use bevy::app::{App, Plugin, Startup, Update};

use self::{drops::exp_move_or_destroyed, player::*};
pub mod drops;
pub mod player;

pub struct PlayerPlugins;

impl Plugin for PlayerPlugins {
    fn build(&self, app: &mut App) {
        app.init_resource::<BuildMonstrtTime>();
        app.init_resource::<PlayerAttackTime>();
        app.init_resource::<AttackMonstrtAminTime>();
        app.insert_resource(Scoreboard { score: 0 });
        app.insert_resource(PlayerLevel { level: 1 });
        app.insert_resource(PlayerExp { exp: 0 });
        app.insert_resource(PlayerUpExp {
            exp: INITIAL_UP_MXP_LEVEL_EXP,
        });
        app.add_systems(Startup, spawn_role);
        app.add_systems(
            Update,
            (
                spawn_monster,
                monster_move,
                move_player,
                palyer_atttack,
                destroyed_monster,
                player_level_up,
                exp_move_or_destroyed,
            ),
        );
    }
}
